﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace VRacer
{
    /// <summary>
    /// Jest to gracz poczatkujacy. Bedzie oferowal podpowiedzi co do najlepszego ruchu i rozne inne ulatwienia.
    /// Generalnie bedzie kierowal duzo informacji tekstowych do gracza. Implentuje takze rozne statystyki ktore beda pomocne w dalszej analizie sposobu gry.
    /// </summary>
    public class NoobPlayer : PathFinderPlayer, ITimeStatistics
    {
        private Point _bestNewPosition;
        private TimeStatistics _timeStatistics = new TimeStatistics();

        public NoobPlayer(Game game)
            : base(game)
        {
            Title = GetName(); 
        }

        #region ITimeStatistics Members

        TimeStatistics ITimeStatistics.Statistics
        {
            get { return _timeStatistics; }
        }

        #endregion

        public Point BestNewPosition
        {
            get { return _bestNewPosition; }
            protected set
            {
                _bestNewPosition = value;
                OnPropertyChanged("BestNewPosition");
            }
        }

        protected override void OnActivated()
        {
            FindWay();
            BestNewPosition = new Point((Position.X + Speed.X + wektor.X), (Position.Y + Speed.Y + wektor.Y));
            _timeStatistics.Start();
            base.OnActivated();
        }

        protected override void OnDeactivated()
        {
            _timeStatistics.End();
            base.OnDeactivated();
        }
    }
}
